﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RecipeBookBusiness
{
    public static class RecipeBook
    {
        private static RecipeBookEntities _entities = new RecipeBookEntities();

        public static List<Recipe> GetRecipes()
        {
            List<Recipe> recipeList = new List<Recipe>();
            foreach (RecipeDataRow rdr in _entities.RecipeDataRowSet)
            {
                recipeList.Add(new Recipe(rdr.ID));
            }
            return recipeList;
        }

        public static List<Ingredient> GetIngredients()
        {
            List<Ingredient> ingredientList = new List<Ingredient>();
            foreach (IngredientDataRow idr in _entities.IngredientDataRowSet)
            {
                ingredientList.Add(new Ingredient(idr.ID));
            }
            return ingredientList;
        }

        public static List<Equipment> GetEquipment()
        {
            List<Equipment> equipmentList = new List<Equipment>();
            foreach (EquipmentDataRow edr in _entities.EquipmentDataRowSet)
            {
                equipmentList.Add(new Equipment(edr.ID));
            }
            return equipmentList;
        }

        public static List<Category> GetCategories()
        {
            List<Category> categoryList = new List<Category>();
            foreach (CategoryDataRow cdr in _entities.CategoryDataRowSet)
            {
                categoryList.Add(new Category(cdr.ID));
            }
            return categoryList;
        }

        public static List<User> GetUsers()
        {
            List<User> userList = new List<User>();
            foreach (UserDataRow udr in _entities.UserDataRowSet)
            {
                userList.Add(new User(udr.ID));
            }
            return userList;
        }

        public static List<Rating> GetRatings()
        {
            List<Rating> ratingList = new List<Rating>();
            foreach (RatingDataRow rdr in _entities.RatingDataRowSet)
            {
                ratingList.Add(new Rating(rdr.ID));
            }
            return ratingList;
        }

        public static List<Comment> GetComments()
        {
            List<Comment> commentList = new List<Comment>();
            foreach (CommentDataRow cdr in _entities.CommentDataRowSet)
            {
                commentList.Add(new Comment(cdr.ID));
            }
            return commentList;
        }

        public static List<Flag> GetFlags()
        {
            List<Flag> flagList = new List<Flag>();
            foreach (DeleteDataRow ddr in _entities.DeleteDataRowSet)
            {
                flagList.Add(new Flag(ddr.IDFlag));
            }
            return flagList;
        }
    }
}
